﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZLCMS.Web.Wap.Code;
using DotNet.Common.Command;
using ZLCMS.Commands.Member.Commands.Product;
using NHibernate;
using DotNet.Common.NHibernateUtil;
using ZLCMS.Commands.Data;
using System.Text;

namespace ZLCMS.Web.Wap.ShoppingCart
{
    public partial class Default : MemberPageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //合并购物车数据
            string selectProducts = "";
            if (HttpContext.Current.Request.Cookies["visit_select_product"] != null)
            {
                selectProducts = HttpUtility.UrlDecode(HttpContext.Current.Request.Cookies["visit_select_product"].Value, Encoding.GetEncoding("UTF-8"));
            }
            if (!string.IsNullOrEmpty(selectProducts))
            {
                List<SelectProductParameterData> selectProductList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SelectProductParameterData>>(selectProducts);
                new SelectProductCommand().Execute(new SelectProductParameter() { MemberAccount = Request["token"], ProductList = selectProductList });

                HttpContext.Current.Response.Cookies.Add(new HttpCookie("visit_select_product", ""));
            }
        }
    }
}